﻿using System.Text;
using System.Web;
using WebDotNet.Extensions;
using WebDotNet.Samples.TodoList.App.Entities;
using WebDotNet.Samples.TodoList.App.Model;

namespace WebDotNet.Samples.TodoList.App.Handlers
{
	public class Index
	{
		public StringBuilder Get(HttpContextBase httpContextBase)
		{
			ViewModels.Index viewData = new ViewModels.Index
			{
				HttpContextBase = httpContextBase, 
				ToDos = new XmlRepository<Todo>().List(), 
				Title = "Todo List"
			};

			StringBuilder stringBuilder = httpContextBase.RenderPage("Index", viewData);

			return stringBuilder;
		}
	}
}
